// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './router/index'
import './config/rem'
import "../static/reset.css"
import {ToastPlugin, LoadingPlugin} from 'vux'
import {routerMode} from "./config/env"
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
import {List} from 'vant'
import {ImagePreview} from 'vant'
import {Picker} from 'vant'
import {Popup} from 'vant'
import {RadioGroup, Radio} from 'vant'
import {Lazyload} from 'vant'
import store from './store/index'

Vue.use(Lazyload)
Vue.use(RadioGroup)
Vue.use(Radio)
Vue.use(Popup)
Vue.use(Picker)
Vue.use(List)
Vue.use(ImagePreview)
Vue.use(VueRouter)
Vue.use(ToastPlugin)
Vue.use(LoadingPlugin)
Vue.use(VueAwesomeSwiper)
Vue.config.productionTip = false

/* eslint-disable no-new */
const router = new VueRouter({
  routes,
  mode: routerMode
});

router.beforeEach((to, form, next) => {
  /*路由变化修改title*/
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});

/* eslint-disable no-new */
let apple = new Vue({
  router,
  store
}).$mount('#app');

export default apple;
